package com.easylinkin.linkappapi.analyze.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 设备资产表，关联两张表
 * 关联1  资产表-资产设备表
 * 关联2  资产表-资产用户表
 *
 * </p>
 *
 * @author XuGuoQing
 * @since 2020-04-23
 */
@Data
@Accessors(chain = true)
@TableName("linkapp_analyze_datasource")
@ApiModel("数据源实体类")
public class AnalyzeDateSource extends Model<AnalyzeDateSource> {

    private static final long serialVersionUID = 1L;

    /**
     * 数据源id
     */
    @TableId("id")
    @ApiModelProperty(value = "数据源id", example = "")
    private String id;

    /**
     * 数据源名称
     */
    @TableField("datasource_name")
    @ApiModelProperty(value = "数据源名称", example = "")
    private String datasourceName;

    /**
     * 资产的描述
     */
    @TableField("datasource_desc")
    @ApiModelProperty(value = "资产的描述", example = "")
    private String datasourceDesc;

    /**
     * 数据源的类型  1-区域 2-指定设备
     */
    @TableField("datasource_type")
    @ApiModelProperty(value = "数据源的类型", example = "1")
    private Integer datasourceType;

    /**
     * 区域id
     */
    @TableField("area_id")
    @ApiModelProperty(value = "区域id", example = "")
    private String areaId;

    @TableField(value = "device_id_string", strategy = FieldStrategy.NOT_NULL)
    @ApiModelProperty(value = "设备ID", example = "")
    private String deviceIdString;

    @TableField(exist = false)
    @ApiModelProperty(value = "", example = "")
    private List deviceIdList;


    @TableField("creator")
    @ApiModelProperty(value = "创建人", example = "")
    private String creator;

    /**
     * 资产的创建时间
     */
    @TableField("create_time")
    @ApiModelProperty(value = "资产的创建时间", example = "")
    private Date createTime;

    @TableField("modifier")
    @ApiModelProperty(value = "修改人", example = "")
    private String modifier;

    /**
     * 资产的修改时间
     */
    @TableField("modify_time")
    @ApiModelProperty(value = "资产的修改时间", example = "")
    private Date modifyTime;

    /**
     * 是否删除字段 0:已删; 1:存在
     */
    @TableField("delete_state")
    @TableLogic(value = "1", delval = "0")
    @ApiModelProperty(value = "是否删除字段", example = "1")
    private Integer deleteState = 1;

    /**
     * 租户ID
     */
    @TableField("tenant_id")
    @ApiModelProperty(value = "租户ID", example = "")
    private String tenantId;

    /**
     * 状态字段 0:失效; 1:有效
     */
    @TableField("status")
    @ApiModelProperty(value = "状态字段", example = "")
    private Integer status;


    /**
     * 空间名称
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "空间名称", example = "")
    private String spaceName;

    /**
     * 空间id
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "空间id", example = "")
    private String spaceId;


    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
